package com.example.human_resource_management.entry.po;

import com.baomidou.mybatisplus.annotation.*;

import java.util.Date;
import lombok.Data;

/**
 * 资源申请表
 * @TableName resource_apply
 */
@TableName(value ="resource_apply")
@Data
public class ResourceApply {
    /**
     * 唯一标识申请
     */
    @TableId(type = IdType.AUTO)
    private Long applyId;

    /**
     * 关联员工ID（申请人），外键关联员工表
     */
    private Long empId;

    /**
     * 关联资源ID，外键关联资源表
     */
    private Long resId;

    /**
     * 申请时间
     */
    @TableField(fill = FieldFill.INSERT)
    private Date applyTime;

    /**
     * 审批状态（如“待审/通过”）
     */
    @TableField(fill = FieldFill.INSERT)
    private String approvalStatus;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        ResourceApply other = (ResourceApply) that;
        return (this.getApplyId() == null ? other.getApplyId() == null : this.getApplyId().equals(other.getApplyId()))
            && (this.getEmpId() == null ? other.getEmpId() == null : this.getEmpId().equals(other.getEmpId()))
            && (this.getResId() == null ? other.getResId() == null : this.getResId().equals(other.getResId()))
            && (this.getApplyTime() == null ? other.getApplyTime() == null : this.getApplyTime().equals(other.getApplyTime()))
            && (this.getApprovalStatus() == null ? other.getApprovalStatus() == null : this.getApprovalStatus().equals(other.getApprovalStatus()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getApplyId() == null) ? 0 : getApplyId().hashCode());
        result = prime * result + ((getEmpId() == null) ? 0 : getEmpId().hashCode());
        result = prime * result + ((getResId() == null) ? 0 : getResId().hashCode());
        result = prime * result + ((getApplyTime() == null) ? 0 : getApplyTime().hashCode());
        result = prime * result + ((getApprovalStatus() == null) ? 0 : getApprovalStatus().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", applyId=").append(applyId);
        sb.append(", empId=").append(empId);
        sb.append(", resId=").append(resId);
        sb.append(", applyTime=").append(applyTime);
        sb.append(", approvalStatus=").append(approvalStatus);
        sb.append("]");
        return sb.toString();
    }
}